package com.wuhainan.beelzebub.controller.system;

import com.wuhainan.beelzebub.entity.system.ChargeItemType;
import com.wuhainan.beelzebub.service.system.ChargeItemTypeService;
import com.wuhainan.beelzebub.utils.PageInfo;
import com.wuhainan.beelzebub.utils.TableData;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <br>Created by 吴海南 on 2017-12-18.
 * <br>星期一 at 上午 10:11.
 */
@RestController
@RequestMapping("api")
public class ChargeItemTypeController {
    @Resource
    private ChargeItemTypeService chargeItemTypeService;
    @RequestMapping("chargeItemTypePage")
    public TableData ChargeItemTypePage(PageInfo pageInfo, ChargeItemType chargeItemType){
        return chargeItemTypeService.findChargeItemTypePage(pageInfo,chargeItemType);
    }
    @RequestMapping("findByType/{type}")
    public List<ChargeItemType> findByType(@PathVariable Integer type){
        return chargeItemTypeService.findByType(type);
    }
    @RequestMapping("findByTypeName/{typeName}")
    public ChargeItemType findByType(@PathVariable String typeName){
        return chargeItemTypeService.findByTypeName(typeName);
    }
    @RequestMapping("chargeItemType/{id}")
    public ChargeItemType chargeItemType(@PathVariable String id) {
        return chargeItemTypeService.findChargeItemTypeById(id);
    }

    @RequestMapping("saveChargeItemType")
    public void saveChargeItemType(@RequestBody ChargeItemType chargeItemType) {
        chargeItemTypeService.saveChargeItemType(chargeItemType);
    }

    @RequestMapping("deleteChargeItemType")
    public void deleteChargeItemType(@RequestBody ChargeItemType chargeItemType) {
        chargeItemTypeService.deleteChargeItemType(chargeItemType);
    }

}
